/**
 * Created by bai on 2015-10-29.
 */
var service = angular.module('service',[]);
service.factory('TransmissionData',function(){
    return{
        info:null
    }
})


service.factory('BACK',function($location){
    var facto={
        lastPage:[],
        backStore:function(lastPage,newPage){
            $location.path(newPage);
            this.lastPage.push(lastPage);
            history.pushState({label:lastPage},"");
        },
        backTo:function(){
            console.log(this.lastPage)
            $location.path(this.lastPage[this.lastPage.length-1]);
            this.lastPage.pop();

        }


    }
    window.onpopstate=function(event){
        //alert(111)
        console.log('event',event.state)
        if(event.state){
            $location.path(event.state.label);
            console.log("系统自带",facto.lastPage)
            facto.lastPage.pop()
        }


    }
    return facto
})